Next: Builtin Label Environments, Previous: Creating Labels, Up: Labels and References [Contents][Index]
RefTeX scans the document in order to find all labels. To make
referencing labels easier, it assigns to each label a category,
the label type (for example section, table, figure,
equation, etc.). In order to determine the label type, RefTeX
parses around each label to see in what kind of environments it
is located. You can speed up the parsing by using type-specific
prefixes for labels and configuring the variable
reftex-trust-label-prefix.
Referencing Labels is really at the heart of RefTeX. Press
C-c ) in order to reference a label
(reftex-reference). This will start a selection
process and finally insert the complete
‘\ref{label}’ into the
buffer.
First, you can select which reference macro you want to use,
e.g., ‘\ref’ or
‘\pageref’. Later in the process you
have another chance to make this selection and you can therefore
disable this step by customizing
reftex-ref-macro-prompt if you find it too
intrusive. See Reference
Styles.
Then, RefTeX will determine the label category which is required. Often that can be figured out from context. For example, if you write ‘As shown in eq.’ and then press C-c ), RefTeX knows that an equation label is going to be referenced. If it cannot figure out what label category is needed, it will query for one.
You will then be presented with a label selection menu. This is a special buffer which contains an outline of the document along with all labels of the given label category. In addition, next to the label there will be one line of context of the label definition, which is some text in the buffer near the label definition. Usually this is sufficient to identify the label. If you are unsure about a certain label, pressing SPC will show the label definition point in another window.
In order to reference a label, move the cursor to the correct
label and press RET. You can also reference
several labels with a single call to
reftex-reference by marking entries with the
m key (see below).
Here is a list of special commands in the selection buffer. A summary of this information is always available from the selection process by pressing ?.
Show a summary of available commands.
Prefix argument.
Go to next label.
Go to previous label.
Jump back to the position where you last left the selection buffer. Normally this should get you back to the last referenced label.
Goto next section heading.
Goto previous section heading.
Jump to section N, using the prefix arg. For example 3 z jumps to section 3.
Show the surroundings of the definition of the current label in another window. See also the f key.
Toggle follow mode. When follow mode is active, the other
window will always display the full context of the current
label. This is similar to pressing SPC
after each cursor motion. Note that only context in files
already visited is shown. RefTeX will not visit a file just
for follow mode. See, however, the variable
reftex-revisit-to-follow.
Show insertion point in another window. This is the point
from where you called reftex-reference.
Insert a reference to the label at point into the buffer from which the selection process was started. When entries have been marked, RET references all marked labels.
Clicking with mouse button 2 on a label will accept it
like RET would. See also variable
reftex-highlight-selection, Options -
Misc.
Mark the current entry. When several entries have been
marked, pressing RET will accept all of them and
place them into several \ref macros. The special
markers ‘,-+’ also store a separator
to be inserted before the corresponding reference. So marking
six entries with the keys ‘m , , - ,
+’ will give a reference list like this (see the
variable reftex-multiref-punctuation)
In eqs. (1), (2), (3)--(4), (5) and (6)
Unmark a marked entry.
Accept the marked entries and put all labels as a
comma-separated list into one single
\ref macro. Some packages like
saferef.sty support multiple references in this
way.
Use the last referenced label(s) again. This is equivalent to moving to that label and pressing RET.
Enter a label with completion. This may also be a label which does not yet exist in the document.
Cycle forward through active reference macros. The
selected macro is displayed by the
‘S<...>’ indicator in the mode
line of the selection buffer. This mechanism comes in handy
if you are using LaTeX packages like varioref or
fancyref and want to use the special referencing
macros they provide (e.g., \vref or
\fref) instead of \ref.
Cycle backward through active reference macros.
Exit the selection process without inserting any reference into the buffer.
The defaults for the following flags can be configured
with the variable reftex-label-menu-flags (see
Options - Referencing Labels).
Toggle the display of the one-line label definition context in the selection buffer.
Toggle the display of the file borders of a multifile document in the selection buffer.
Toggle the display of the table of contents in the selection buffer. With prefix arg, change the maximum level of toc entries displayed to arg. Chapters are level 1, sections are level 2.
Toggle the display of a label counter in the selection buffer.
Toggle the display of labels hidden in comments in the selection buffers. Sometimes, you may have commented out parts of your document. If these parts contain label definitions, RefTeX can still display and reference these labels.
Update the menu. This will rebuilt the menu from the internal label list, but not reparse the document (see r).
Reparse the document to update the information on all
labels and rebuild the menu. If the variable
reftex-enable-partial-scans is
non-nil and your document is a multifile
document, this will reparse only a part of the document (the
file in which the label at point was defined).
Reparse the entire document.
Switch the label category. After prompting for another label category, a menu for that category will be shown.
Reference a label from an external document. With the
LaTeX package xr it is possible to reference
labels defined in another document. This key will switch to
the label menu of an external document and let you select a
label from there (see xr).
In order to define additional commands for the selection
process, the keymap reftex-select-label-map may be
used.
Next: Builtin Label Environments, Previous: Creating Labels, Up: Labels and References [Contents][Index]